SHELL=/bin/sh

CC=gcc


# read options (such as -march) which are specific
# for a particular machine
#LOCAL_OPTIONS=`cat local_options`
#LOCAL_OPTIONS=-march=pentium4


#these are for testing
CFLAGS = -g -W -Wall -Winline -O2

#these are for maximum speed
#CFLAGS=-g -O3 -fomit-frame-pointer -W -Wall -Winline \
#       -DDEBUG=0 -DNDEBUG=1 $(LOCAL_OPTIONS)

# these are for profiling (-a?) 
#CFLAGS = -g -pg -O2 -W -Wall -Winline -DDEBUG=0


.PHONY: all
all : huffrle huffrle.a

huffrlelib : huffrle.a


huffrle: main.o huffrle.o huffman_codes.o bitio.o misc.o  
	 $(CC) $(CFLAGS) -o huffrle main.o huffrle.o huffman_codes.o \
         bitio.o misc.o -lm

huffrle.a: huffrle.o huffman_codes.o bitio.o misc.o
	ar rc huffrle.a huffrle.o huffman_codes.o bitio.o misc.o

# pattern rule for all objects files
%.o: %.c *.h
	$(CC) -c $(CFLAGS) $< -o $@

clean: 
	rm -f *.o *.a huffrle

tarfile:
	tar zcvf huffrle.tgz makefile *.c *.h






